package com.checker.designPattern.creation.factory;

public class FactoryTest {
    public static void main(String[] args) {

        System.out.println("=====简单工厂=====");
        SimpleFactory factory = new SimpleFactory();

        System.out.println(factory.createObject("A").show());
        System.out.println(factory.createObject("B").show());
//        System.out.println(factory.creatObject("A").getClass() == ObjectA.class);
//        System.out.println(factory.creatObject("B").getClass() == ObjectB .class);
//        System.out.println(factory.creatObject("C") == null);


        System.out.println("=====工厂模式=====");
        FactoryPattern factoryA = new FactoryA();
        FactoryPattern factoryB = new FactoryB();

        System.out.println(factoryA.createObject().show());
        System.out.println(factoryB.createObject().show());
//        System.out.println(factoryA.creatObject().getClass() == ObjectA.class);
//        System.out.println(factoryB.creatObject().getClass() == ObjectB .class);

        System.out.println("=====抽象工厂模式=====");
        AbstractFactory abstractFactoryA = new AbstractFactoryA();
        AbstractFactory abstractFactoryB = new AbstractFactoryB();

        System.out.println(abstractFactoryA.createObjectA().show());
        System.out.println(abstractFactoryA.createObjectB().show());
        System.out.println();
        System.out.println(abstractFactoryB.createObjectA().show());
        System.out.println(abstractFactoryB.createObjectB().show());


    }
}
